package com.SunSoft.PhoneRemoteControl;

import android.media.AudioManager;
import android.media.MediaPlayer;
import android.os.Build.VERSION;
import android.os.Vibrator;
import com.tasogo.comm.e;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;

final class dz
  implements Runnable
{
  public final void run()
  {
    Object localObject;
    Show_Control.d(this.a).setStreamVolume(3, Show_Control.e(this.a), 0);
    Show_Control.d(this.a).setSpeakerphoneOn(false);
    if (!(Show_Control.d(this.a).isWiredHeadsetOn()))
      Show_Control.a("Test", "no WiredHeadset");
    if (this.a.aC == 1)
    {
      Show_Control.a("Test", "MESSAGE_creat");
      if (Show_Control.f(this.a).isPlaying())
        Show_Control.f(this.a).reset();
      Show_Control.a("Test", "send_code:" + this.a.h);
      if (Show_Control.g(this.a) != 5)
        break label624;
      localObject = this.a.h;
      if (Show_Control.h(this.a) <= 0)
        break label721;
      if ((Show_Control.g(this.a) != 5) && (this.a.U[this.a.g] != null) && (this.a.U[this.a.g] != ""))
        break label639;
      localObject = Show_Control.i(this.a).b((String)localObject);
      this.a.U[this.a.g] = localObject;
      this.a.E = false;
    }
    try
    {
      if ((Show_Control.h(this.a) == 1) || (Show_Control.h(this.a) == 2) || (Show_Control.h(this.a) == 5) || (Show_Control.h(this.a) == 3))
        if ((Show_Control.h(this.a) == 2) && (Build.VERSION.SDK_INT > 20))
        {
          Show_Control.a(this.a, Show_Control.e().a((String)localObject, 2));
          Show_Control.a("Test", "is_doing_sam=false");
          this.a.aC = 0;
          if (this.a.aC == 6)
          {
            Show_Control.a("Test", "MESSAGE_direct_play");
            if (Show_Control.f(this.a).isPlaying())
              Show_Control.f(this.a).reset();
            if ((!(MyApplication.a().a)) && (!(MyApplication.a().e)) && (MyApplication.a().c))
            {
              MyApplication.a().f = false;
              MyApplication.a().a(true, this.a);
            }
            localObject = new File("/data/data/com.SunSoft.PhoneRemoteControl/tsg_temp_save" + String.valueOf(this.a.g) + ".png");
            Show_Control.a("Test", "wav_file:" + ((File)localObject).getName());
            this.a.H = false;
            if (!(((File)localObject).exists()))
              break label811;
            Show_Control.f(this.a).reset();
            Show_Control.f(this.a).setLooping(false);
          }
        }
    }
    catch (NullPointerException localIOException)
    {
      try
      {
        while (true)
        {
          do
            while (true)
            {
              while (true)
              {
                while (true)
                {
                  while (true)
                  {
                    localObject = new FileInputStream((File)localObject);
                    Show_Control.f(this.a).setDataSource(((FileInputStream)localObject).getFD());
                    Show_Control.f(this.a).prepare();
                    Show_Control.f(this.a).start();
                    if (this.a.I)
                      ((Vibrator)this.a.getSystemService("vibrator")).vibrate(new long[] { 5L, 10L, 5L, 10L }, -1);
                    Show_Control.a("Test", "play start OK 1");
                    this.a.aC = 0;
                    return;
                    label624: localObject = Show_Control.a(this.a.h, 0);
                  }
                  label639: localObject = this.a.U[this.a.g];
                }
                Show_Control.a(this.a, Show_Control.e().a((String)localObject, 0));
              }
              localNullPointerException = localNullPointerException;
              Show_Control.a(this.a, false);
            }
          while (Show_Control.h(this.a) != 4);
          Show_Control.a(this.a, Show_Control.e().a(localNullPointerException, 1));
        }
        if ((!(MyApplication.a().a)) && (!(MyApplication.a().e)) && (MyApplication.a().c))
        {
          label721: MyApplication.a().f = false;
          MyApplication.a().a(true, this.a);
        }
        label811: Show_Control.a(this.a, localNullPointerException, 0);
      }
      catch (FileNotFoundException localFileNotFoundException)
      {
        while (true)
          localFileNotFoundException.printStackTrace();
      }
      catch (IllegalArgumentException localIllegalArgumentException)
      {
        while (true)
          localIllegalArgumentException.printStackTrace();
      }
      catch (IllegalStateException localIllegalStateException)
      {
        while (true)
          localIllegalStateException.printStackTrace();
      }
      catch (IOException localIOException)
      {
        while (true)
        {
          while (true)
            localIOException.printStackTrace();
          Show_Control.a("Test", "file not exists 1!!");
        }
      }
    }
  }
}